import request from '@/utils/request'

// 查询团长注册申请表列表
export function listPickup(query) {
  return request({
    url: '/pickup/list',
    method: 'get',
    params: query
  })
}

// 查询团长注册申请表详细
export function getPickup(applicationId) {
  return request({
    url: '/pickup/' + applicationId,
    method: 'get'
  })
}

// 新增团长注册申请表
export function addPickup(data) {
  return request({
    url: '/pickup',
    method: 'post',
    data: data
  })
}

// 修改团长注册申请表
export function updatePickup(data) {
  return request({
    url: '/pickup',
    method: 'put',
    data: data
  })
}

// 删除团长注册申请表
export function delPickup(applicationId) {
  return request({
    url: '/pickup/' + applicationId,
    method: 'delete'
  })
}

// 审核团长注册申请
export function auditPickup(applicationId, data) {
  return request({
    url: '/pickup/audit/' + applicationId,
    method: 'post',
    data: data
  })
}

// 审核通过
export function approvePickup(applicationId, data) {
  return request({
    url: '/pickup/audit/' + applicationId,
    method: 'post',
    data: { ...data, status: 'approved' }
  })
}

// 审核拒绝
export function rejectPickup(applicationId, data) {
  return request({
    url: '/pickup/audit/' + applicationId,
    method: 'post',
    data: { ...data, status: 'rejected' }
  })
}

// 批量审核团长注册申请
export function batchAuditPickup(data) {
  return request({
    url: '/pickup/batchAudit',
    method: 'post',
    data: data
  })
}

// 批量审核通过
export function batchApprovePickup(ids, data) {
  return request({
    url: '/pickup/batchAudit',
    method: 'post',
    data: { 
      applicationIds: ids,
      status: 'approved',
      ...data
    }
  })
}

// 批量审核拒绝
export function batchRejectPickup(ids, data) {
  return request({
    url: '/pickup/batchAudit',
    method: 'post',
    data: { 
      applicationIds: ids,
      status: 'rejected',
      ...data
    }
  })
}
